package com.hnhs.controller;

import com.hnhs.model.Category;
import com.hnhs.model.CategoryQuery;
import com.hnhs.model.Videos;
import com.hnhs.model.VideosQuery;
import com.hnhs.service.CategoryService;
import com.hnhs.service.VideosService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/videos")
public class VideosController {
    @Autowired
    private VideosService service;

    @GetMapping
    public List<Videos> select(VideosQuery query){
        return service.select(query);
    }


    @PostMapping
    public Integer insert(@RequestBody Videos videos){
        return  service.insert(videos);
    }
    @PutMapping
    public Integer update(@RequestBody Videos videos){
        return  service.update(videos);
    }
    @DeleteMapping
    public Integer delete(Integer id){
        return  service.delete(id);
    }
}
